--[[ -------------------------------------------------------
Contains the values available for retrieving information
about a MUSHclient MiniWindow.

$URL: http://mushclient-lua-objects.googlecode.com/svn/branches/working/Daesilme/MUSHclient/MiniWindow/Info.lua $

Copyright (C) 2009 Daesilme (Daniel W. Drake)

This file is part of mushclient-lua-objects.

mushclient-lua-objects is free software: you can
redistribute it and/or modify it under the terms of the GNU
General Public License as published by the Free Software
Foundation, either version 2 of the License, or (at your
option) any later version.

mushclient-lua-objects is distributed in the hope that it
will be useful, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.  See the GNU General Public License for
more details.

You should have received a copy of the GNU General Public
License along with mushclient-lua-objects.  If not, see
<http://www.gnu.org/licenses/>.
------------------------------------------------------- ]]--

require("class");

class "Info";

local InfoClass = Info:classtable();

------------------------------------------------------------
-- PUBLIC CLASS PROPERTIES
------------------------------------------------------------
InfoClass.ORIG		=	{
	LEFT			=	1,
	TOP				=	2
};
InfoClass.SIZE		=	{
	WIDTH			=	3,
	HEIGHT			=	4
};
InfoClass.VISIBLE	=	5;
InfoClass.HIDDEN	=	6;
InfoClass.POSITION	=	7;
InfoClass.FLAGS		=	8;
InfoClass.BGCOLOR	=	9;
InfoClass.COORDS	=	{
	LEFT			=	10,
	TOP				=	11,
	RIGHT			=	12,
	BOTTOM			=	13
};
InfoClass.MOUSE		=	{
	MINI			=	{
		X			=	14,
		Y			=	15
	},
	COUNTER			=	16,
	OUTPUT		=	{
		X			=	17,
		Y			=	18
	}
};
InfoClass.HOTSPOT	=	{
	MOUSE_OVER		=	19,
	MOUSE_DOWN		=	20
};

------------------------------------------------------------
-- PUBLIC CLASS METHODS
------------------------------------------------------------

-- Returns if the value @info is a valid MiniWindow Info value.
function InfoClass:isValid(info)
	return (
		(info ~= nil)	and
		(info >= 1)		and
		(info <= 20)
	);
end   -- InfoClass:isValid(info)

-- Returns a string representation of the MiniWindow Info.
function InfoClass:toString(info)
	if(self:isValid(info)) then
		return self.private.INFO_TO_STRING[info];
	else
		error(
			string.format(
				"[%s] is not a valid MiniWindow Info",
				tostring(info)
			)
		);
	end
end   -- InfoClass:toString(info)

-- Returns the MiniWindow Info requested by @info for @win.
-- @see WindowInfo (http://www.gammon.com.au/scripts/doc.php?function=WindowInfo)
function InfoClass:get(win, info)
	if(self:isValid(info)) then
		local result = WindowInfo(win, info);
		if(result == nil) then
			error(
				string.format(
					"[%s] is not a valid MiniWindow",
					tostring(win)
				)
			);
		end
		return result;
	else
		error(
			string.format(
				"[%s] is not a valid MiniWindow Info",
				tostring(info)
			)
		);
	end
end   -- InfoClass:get(win, info)

------------------------------------------------------------
-- PUBLIC OBJECT PROPERTIES
------------------------------------------------------------

------------------------------------------------------------
-- PUBLIC OBJECT METHODS
------------------------------------------------------------

-- Constructor
-- Raises error to prevent instantiation
function Info:initialize()
	error("MUSHclient.MiniWindow.Info cannot be instantiated.");
end   -- Info:initialize()

------------------------------------------------------------
-- PRIVATE CLASS PROPERTIES
------------------------------------------------------------
InfoClass.private	=	{
	INFO_TO_STRING	=	{
		[1]		=	"Original Left",
		[2]		=	"Original Top",
		[3]		=	"Width",
		[4]		=	"Height",
		[5]		=	"Visible",
		[6]		=	"Hidden",
		[7]		=	"Position",
		[8]		=	"Flags",
		[9]		=	"Background Color",
		[10]	=	"Left",
		[11]	=	"Top",
		[12]	=	"Right",
		[13]	=	"Bottom",
		[14]	=	"Mouse X in MiniWindow",
		[15]	=	"Mouse Y in MiniWindow",
		[16]	=	"Mouse Update Counter",
		[17]	=	"Mouse X in Output",
		[18]	=	"Mouse Y in Output",
		[19]	=	"Current Mouse Over Hotspot",
		[20]	=	"Current Mouse Down Hotspot"
	}
};

------------------------------------------------------------
-- PRIVATE CLASS METHODS
------------------------------------------------------------

------------------------------------------------------------
-- PRIVATE OBJECT PROPERTIES
------------------------------------------------------------

------------------------------------------------------------
-- PRIVATE OBJECT METHODS
------------------------------------------------------------
